<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<table class="table table-bordered" style="border-bottom: none">
	<tr>
		<td>
			<ul id="allotauthority_tree" class="ztree"></ul>
		</td>
	</tr>
	<tr>
		<td>
		<div style="margin-top: 10px; margin-bottom: 10px; text-align: center;">
			<form method="post" action="${rootURL}role/allotauthority.html" id="${param.rel}_allotauthority">
				<input type="hidden" name="id" value="${param.id}"> 
				<input type="hidden" name="authorityId" value="">
				<input type="hidden" name="datagridId" value="dg_${param.rel}" />
				<input type="hidden" name="currentCallback" value="close" />
				<button type="submit" class="btn btn-primary">修改</button>
			</form>
			</div>
		</td>
	</tr>
</table>
<script type="text/javascript">
	$(document).ready(function() {

		var setting = {
			check : {
				enable : true
			},
			data : {
				simpleData : {
					enable : true
				}
			},
			callback: {
				onCheck: onCheck
			}
		};
		
		
		function onCheck(e, treeId, treeNode){
			var treeObj = $.fn.zTree.getZTreeObj("allotauthority_tree");
	        var nodes = treeObj.getCheckedNodes(true);
	        var ids = "";
	        $.each(nodes,function(){
	        	ids = ids+","+this.id;
	        });
	        ids = ids.substring(1);
	        $("form#${param.rel}_allotauthority").find("input[name='authorityId']").val(ids);
	        
		}

		var zNodes = ${json};
		$.fn.zTree.init($("#allotauthority_tree"), setting, zNodes);

	});
</script>

